package encaps.utils.rendering;

import encaps.resources.Response;
import static encaps.utils.html.HTML.*;
import encaps.utils.html.HTMLElement;
import org.jdom.Element;

public class HiddenTextFieldFactory implements FieldFactory {

    @Override
    public HTMLElement renderField(Element e, boolean edit) {
        HTMLElement input = new HTMLElement(INPUT);
        input.addAttribute(TYPE, HIDDEN);
        String key = e.getChildTextTrim(Response.KEY);
        input.addAttribute(NAME, key);
        String value = e.getChildTextTrim(Response.VALUE);
        input.addAttribute(VALUE, value);
        return input;
    }
}
